package com.arvin.skin.core.utils;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;

public class SkinPreference {
    private static SkinPreference instance;
    private static final String SKIN_SHARED = "SKIN_SHARED";
    private static final String KEY_SKIN_PATH = "KEY_SKIN_PATH";
    private SharedPreferences mPref;
    private SkinPreference(Context context) {
        mPref = context.getSharedPreferences(SKIN_SHARED,Context.MODE_PRIVATE);
    }

    public static void init(Context context){
        if (instance == null) {
            synchronized (SkinPreference.class){
                if (instance == null) {
                    instance = new SkinPreference(context);
                }
            }
        }
    }

    public static SkinPreference getInstance() {
        return instance;
    }

    public void setSkin(String path){
        mPref.edit().putString(KEY_SKIN_PATH,path).apply();
    }

    public String getSkin(){
        return mPref.getString(KEY_SKIN_PATH,null);
    }
}
